<template>
	<!-- 20230202 -->
	<view class="mall-my-refund-detail-page">
		<!-- 页面内容 -->
		<view class="page-content padding-bottom-safe-footer-20">

			<!-- 退款产品 -->
			<view class="bg-ff padding-tb-10 padding-lr-30">
				<jc-mall-orderProducts :list="[orderProduct]"></jc-mall-orderProducts>
			</view>
		
			<!-- 退款信息 -->
			<view class="margin-top-20 padding-lr-30 padding-top-30 bg-ff">
				<view class="text-40 text-main padding-bottom-20">{{detail.status_text}}</view>
				<view class="line-height-60 flex align-center justify-between">
					<view class="text-28">退款原因</view>
					<view class="text-28 text-77">{{detail.cause_content}}</view>
				</view>
				<view class="line-height-60 flex align-center justify-between">
					<view class="text-28">商品件数</view>
					<view class="text-28 text-77">{{detail.refund_number}}</view>
				</view>
				<view class="line-height-60 flex align-center justify-between">
					<view class="text-28">退款金额</view>
					<view class="text-28 text-77">¥{{detail.refund_money}}</view>
				</view>
				<view class="flex justify-between">
					<view class="line-height-60 text-28">退款说明</view>
					<view class="flex-one padding-tb-10 line-40 text-right text-28 text-77">{{detail.remark}}</view>
				</view>
				<view class="padding-top-10 flex align-center justify-between">
					<view class="text-28">凭证截图</view>
				</view>
				<view class="padding-top-5 padding-bottom-15">
					<ty-image-images :list="detail.cause_img" :width="160" :height="160"></ty-image-images>
				</view>
			</view>

			<view class="margin-top-20 padding-lr-30 padding-tb-20 bg-ff">
				<view class="line-height-60 flex align-center justify-between">
					<view class="text-28">退款编号：</view>
					<view class="text-28 text-77">{{detail.refund_order_number}}</view>
				</view>
				<view class="line-height-60 flex align-center justify-between">
					<view class="text-28">申请时间：</view>
					<view class="text-28 text-77">{{detail.show_create_time}}</view>
				</view>
				<view class="line-height-60 flex align-center justify-between" v-if="detail.is_arrival == 1">
					<view class="text-28">退款时间：</view>
					<view class="text-28 text-77">{{detail.show_arrival_time}}</view>
				</view>
				<view class="flex justify-between" v-if="detail.status == 3">
					<view class="line-height-60 text-28">拒绝原因：</view>
					<view class="flex-one padding-tb-10 line-40 text-right text-28 text-77">{{detail.refuse_text}}</view>
				</view>
			</view>

			<view class="jc-footer-safe bg-ff">
				<view class="line-height-footer padding-lr-30 flex align-center justify-end">
					<jc-mall-myRefundBtn :status="detail.status" :refund-id="refundId" 
						open-type="2"></jc-mall-myRefundBtn>
				</view>
			</view>
		</view>

		<!-- 页面浮层 -->
		<view class="page-layer">

		</view>
	</view>
</template>

<script>
	import mall from "../api/mall.js"
	export default {
		data() {
			return {
				// 退款订单ID
				refundId: '',
				// 退款产品
				orderProduct: {},
				// 退款详情
				detail: {
					cause_img: []
				},

			}
		},

		onLoad(options) {
			this.refundId = options.id || ''
		},

		onReady() {
			// 获取退款订单
			mall.refund.getRefund(this.refundId).then(res => {
				if (res.code == 0) {
					this.detail = res.data.detail
					
					// 获取退款产品
					mall.refund.getRefundProduct(this.detail.order_product_id).then(res => {
						if (res.code == 0) {
							this.orderProduct = res.data.order_product
						}
					})
				}
			})
			
			
		},

		methods: {
			/**
			 * 撤销申请
			 * @date 2023-02-02
			 */
			// cancel() {
			// 	this.cn.confirm('确认撤销退款吗').then(res => {
			// 		if (res.confirm) {
			// 			mall.refund.refundOrderCancel(this.refundId).then(res => {
			// 				if (res.code == 0) {
			// 					this.cn.alert(res.msg).then(res => {
			// 						uni.navigateBack({
			// 							delta: 2
			// 						})
			// 					})
			// 				}
			// 			})
			// 		}
			// 	})
			// }
		}
	}
</script>
<style scoped>

</style>
